package com.company;

public class test1 {
    public static void main(String[] args) {
      //  method();
        method1();
    }
    public static void method(){
        String a="ni";
        String res="";

        long star=System.currentTimeMillis();
        for(int i=0;i<100000;i++){
            res=res+a;
        }
        long end=System.currentTimeMillis();

        System.out.println(res);
        System.out.println(end-star);
    }
    public static void method1(){
        String a="ni";
        String res="";
         StringBuffer sb=new StringBuffer();
         long star=System.currentTimeMillis();
        for(int i=0;i<100000;i++){
            sb.append(a);
        }
        long end=System.currentTimeMillis();

        System.out.println(sb);
        System.out.println(end-star);
    }
}
